﻿using System;
using System.IO;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Navigation;

namespace EAppointmentsWPF
{
	public partial class Details
	{
        int ActiveOption;
		public Details()
		{

            this.InitializeComponent();
            Option1.Fill = (Brush)this.Resources["HighlightedOptionBrush"];
            txtOption1.Foreground = Brushes.White;
            ActiveOption = 1;

            // Insert code required on object creation below this point.
        }
        public event EventHandler WindowCollapsed;

        private void btnNext_Click(object sender, RoutedEventArgs e)
        {
            switch (ActiveOption)
            {
                case 1: ActiveOption = 2;
                    PatientGrid.Visibility = Visibility.Hidden;
                    ProviderGrid.Visibility = Visibility.Visible;
                    ((Storyboard)this.Resources["ShiftBacktoOriginal"]).Begin(this);
                    btnBack.Visibility = Visibility.Visible;
                    btnBack.IsEnabled = true;
                    btnNext.IsEnabled = true;
                    PatientOption.FontSize = 14;
                    ProviderOption.FontSize = 22;
                    Option1.Fill = Brushes.Transparent;
                    txtOption1.Foreground = (Brush)this.Resources["BlueFontBrush"];
                    Option2.Fill = (Brush)this.Resources["HighlightedOptionBrush"];
                    txtOption2.Foreground = Brushes.White;
                    PatientArrow.Visibility = Visibility.Hidden;
                    ProviderArrow.Visibility = Visibility.Visible;
                    ProviderOption.FontWeight = FontWeights.Bold;
                    PatientOption.FontWeight = FontWeights.Normal;

                    break;
                case 2: ActiveOption = 3;
                    ProviderGrid.Visibility = Visibility.Hidden;
                    BookSlotGrid.Visibility = Visibility.Visible;
                    ProviderOption.FontSize = 14;
                    BookSlotOption.FontSize = 22;
                    Option2.Fill = Brushes.Transparent;
                    txtOption2.Foreground = (Brush)this.Resources["BlueFontBrush"];
                    Option3.Fill = (Brush)this.Resources["HighlightedOptionBrush"];
                    txtOption3.Foreground = Brushes.White;
                    ProviderArrow.Visibility = Visibility.Hidden;
                    BookSlotArrow.Visibility = Visibility.Visible;
                    ProviderOption.FontWeight = FontWeights.Normal;
                    BookSlotOption.FontWeight = FontWeights.Bold;
                    break;
                case 3: ActiveOption = 4;
                    BookSlotGrid.Visibility = Visibility.Hidden;
                    SummaryGrid.Visibility = Visibility.Visible;
                    btnNext.Visibility = Visibility.Hidden;
                    ((Storyboard)this.Resources["ShiftBacktoNext"]).Begin(this);
                    BookSlotOption.FontSize = 14;
                    SummaryOption.FontSize = 22;
                    Option3.Fill = Brushes.Transparent;
                    txtOption3.Foreground = (Brush)this.Resources["BlueFontBrush"];
                    Option4.Fill = (Brush)this.Resources["HighlightedOptionBrush"];
                    txtOption4.Foreground = Brushes.White;
                    BookSlotArrow.Visibility = Visibility.Hidden;
                    SummaryArrow.Visibility = Visibility.Visible;
                    BookSlotOption.FontWeight = FontWeights.Normal;
                    SummaryOption.FontWeight = FontWeights.Bold;
                    break;
            }
        }

        private void btnBack_Click(object sender, RoutedEventArgs e)
        {
            switch (ActiveOption)
            {
                case 4: ActiveOption = 3;
                    SummaryGrid.Visibility = Visibility.Hidden;
                    BookSlotGrid.Visibility = Visibility.Visible;
                    ((Storyboard)this.Resources["ShiftBacktoOriginal"]).Begin(this);
                    btnNext.Visibility = Visibility.Visible;
                    SummaryOption.FontSize = 14;
                    BookSlotOption.FontSize = 22;
                    Option4.Fill = Brushes.Transparent;
                    txtOption4.Foreground = (Brush)this.Resources["BlueFontBrush"];
                    Option3.Fill = (Brush)this.Resources["HighlightedOptionBrush"];
                    txtOption3.Foreground = Brushes.White;
                    SummaryArrow.Visibility = Visibility.Hidden;
                    BookSlotArrow.Visibility = Visibility.Visible;
                    SummaryOption.FontWeight = FontWeights.Normal;
                    BookSlotOption.FontWeight = FontWeights.Bold;
                    break;
                case 3: ActiveOption = 2;
                    BookSlotGrid.Visibility = Visibility.Hidden;
                    ProviderGrid.Visibility = Visibility.Visible;
                    BookSlotOption.FontSize = 14;
                    ProviderOption.FontSize = 22;
                    Option3.Fill = Brushes.Transparent;
                    txtOption3.Foreground = (Brush)this.Resources["BlueFontBrush"];
                    Option2.Fill = (Brush)this.Resources["HighlightedOptionBrush"];
                    txtOption2.Foreground = Brushes.White;
                    BookSlotArrow.Visibility = Visibility.Hidden;
                    ProviderArrow.Visibility = Visibility.Visible;
                    BookSlotOption.FontWeight = FontWeights.Normal;
                    ProviderOption.FontWeight = FontWeights.Bold;
                    break;
                case 2: ActiveOption = 1;
                    ProviderGrid.Visibility = Visibility.Hidden;
                    PatientGrid.Visibility = Visibility.Visible;
                    ((Storyboard)this.Resources["ShiftBacktoNext"]).Begin(this);
                    btnBack.Visibility = Visibility.Visible;
                    ProviderOption.FontSize = 14;
                    PatientOption.FontSize = 22;
                    Option2.Fill = Brushes.Transparent;
                    txtOption2.Foreground = (Brush)this.Resources["BlueFontBrush"];
                    Option1.Fill = (Brush)this.Resources["HighlightedOptionBrush"];
                    txtOption1.Foreground = Brushes.White;
                    ProviderArrow.Visibility = Visibility.Hidden;
                    PatientArrow.Visibility = Visibility.Visible;
                    ProviderOption.FontWeight = FontWeights.Normal;
                    PatientOption.FontWeight = FontWeights.Bold;

                    break;
            }
        }

        private void btnCancel_Click(object sender, RoutedEventArgs e)
        {
            this.Visibility = Visibility.Hidden;
            if (WindowCollapsed != null)
            {
                WindowCollapsed(sender, new EventArgs());
            }
        }

        private void DetailsControl_IsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e)
        {

            if (this.IsVisible == true)
            {
                PatientGrid.Visibility = Visibility.Visible;
                txtOption1.Foreground = Brushes.White;
                ((Storyboard)this.Resources["ShiftBacktoNext"]).Begin(this);
                btnBack.Visibility = Visibility.Hidden;
                PatientOption.FontSize = 22;
                PatientArrow.Visibility = Visibility.Visible;
                PatientOption.FontWeight = FontWeights.Bold;
                Option1.Fill = (Brush)this.Resources["HighlightedOptionBrush"];
                switch (ActiveOption)
                {

                    case 2:

                        ProviderGrid.Visibility = Visibility.Hidden;
                        ProviderOption.FontSize = 14;
                        Option2.Fill = Brushes.Transparent;
                        ProviderArrow.Visibility = Visibility.Hidden;
                        ProviderOption.FontWeight = FontWeights.Normal;
                        txtOption2.Foreground = (Brush)this.Resources["BlueFontBrush"];
                        break;
                    case 3:
                        BookSlotGrid.Visibility = Visibility.Hidden;
                        BookSlotOption.FontSize = 14;
                        Option3.Fill = Brushes.Transparent;
                        BookSlotArrow.Visibility = Visibility.Hidden;
                        BookSlotOption.FontWeight = FontWeights.Normal;
                        txtOption3.Foreground = (Brush)this.Resources["BlueFontBrush"];
                        break;
                    case 4:
                        SummaryGrid.Visibility = Visibility.Hidden;
                        SummaryOption.FontSize = 14;
                        Option4.Fill = Brushes.Transparent;
                        SummaryArrow.Visibility = Visibility.Hidden;
                        SummaryOption.FontWeight = FontWeights.Normal;
                        txtOption3.Foreground = (Brush)this.Resources["BlueFontBrush"];
                        break;
                }
                ActiveOption = 1;
            }
        }

    }
}